Skip to content

V2 follow-ups round 2: enrollment deadline, report-status conflict, DCV domain lookup cache - #41

Merged
spbsoluble merged 17 commits into
feat/v2-spec-followupsfrom
feat/v2-followups-round2
Nov 17, 2026
Merged

spbsoluble merged 17 commits into
feat/v2-spec-followupsfrom
feat/v2-followups-round2

Conversation

@spbsoluble

@spbsoluble spbsoluble commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Enrollment now stops waiting before Command's workflow timeout. Sync handles one more report status pair, and DCV caches SSL.com domain lookups.

Features

  • New setting EnrollmentCallBudgetSeconds:
    • Default 50, 0 turns it off, maximum 90.
    • Enroll starts a deadline, and the pickup shortens its waits to fit.
    • When no poll fits, it stops and returns pending.
    • Calls already running are never cut short, and orders are never retried.
  • Where the 60 s comes from: Command's limit is the global "Workflow Step Run Timeout" (AppSetting 208). The docs say to set the budget about 10 s below it.
  • SSL.com domain lookup cache:
    • One cache per sync pass, and one per Enroll or GetSingleRecord DCV call.
    • Failed lookups aren't cached.
    • The DCV state is still read fresh for each order.

Fixes

  • Order Fulfilled | Pending for Approver:
    • Sync now asks Track Order about these rows.
    • If the order is issued but the download answers 422 EMS-1165 and the report says pending, the row is sent as pending.
    • GetSingleRecord uses the same rule. That also covers Approved by System.

Chores

  • Docs: a new section on Command's workflow step timeout and EnrollmentCallBudgetSeconds. Inline DCV is listed under Known Limitations.
  • Test seams: Clock (TimeProvider) and PickupDelayAsync.

Testing

  • Unit tests: 1334 passed (38 new), and 1249 with DcvSupport=false.
  • Release builds: 0 warnings in both configs.
  • Existing pickup and DCV suites: still pass.

Other

spbsoluble and others added 4 commits November 14, 2026 12:50
…ws through Track Order

The report row says fulfilled while the certificate status says pending; Track Order
returns issued (live: 1125823297). Preferring certificateStatus reported the order as
pending and never downloaded the certificate. That one shape (order maps issued,
certificate maps pending) now maps to null so the sync asks Track Order, and the pair
appears in UnmappedReportStatuses. Other disagreements keep their mapping.
FindSslComDomainAsync called GET /domains for every pending domain on every DCV
attempt, so a pass over many orders under one domain repeated the same lookup. A
per-pass cache (one per sync pass, one per Enroll/GetSingleRecord DCV call) keeps
found rows and "no row"; failed lookups aren't cached and fall back to emSign as
before. Only DomainId/validatedBy come from the cached row; DCV state is still read
fresh per order. Sync processes rows sequentially, so a plain dictionary.
…entry

Command fails the Keyfactor-Enroll workflow step at its global Workflow Step Run
Timeout (Workflow.General.Timeout, 60 s by default; the step has no timeout of its
own). The pickup budget (5 s + PickupRetries x PickupDelay, capped at 75 s) was
counted from the start of the pickup, so the create time came on top: on the lab a
new DV order and a reissue (26 s) both reached Command's 60 s, which recorded a
failure while the order went on at CERTInext.

New setting EnrollmentCallBudgetSeconds (default 50, 0 disables, clamped to 90 under
the 100 s HttpClient timeout). Enroll starts an EnrollmentDeadline, carried in an
AsyncLocal to the V1 new/renew and V2 pickups. They shorten waits to keep a 3 s poll
margin, skip the delay after the last poll, and stop with one Information line when
no poll fits. In-flight calls are never cut short; PickupRetries=0 is unchanged;
inline DCV is not bounded (documented as a known limitation).
spbsoluble and others added 8 commits November 15, 2026 12:51
…prover' order

Opt-in (CERTINEXT_V2_FULFILLED_PENDING_SYNC=1), read-only. A DispatchProxy narrows the
real report listing to one order and forwards every other call to the real client, so
the actual Synchronize path runs live. Asserts the row defers to Track Order, comes out
issued, and has its certificate download attempted. Live 2026-11-15 on 1125823297:
Track issued, download 422 EMS-1165 (never generated), emitted issued without a body.
… its certificate isn't generated

Live on 1125823297: Track Order says issued, but Download Certificate answers 422
EMS-1165 for an order placed months before the sandbox stopped generating, so the
report's 'Pending for Approver' was right. Such a row (Track fallback said issued, the
report's certificate status maps to pending, download EMS-1165) is now emitted pending
instead of issued without a certificate. The download is still tried every pass, so
a certificate that appears is imported. Other download failures, and rows whose
report doesn't say pending, keep the issued-without-body behaviour.
…certificate and a pending certificate state

Matches the V2 sync rule: Track says issued, Download Certificate answers 422
EMS-1165, and the order's certificateState (same text as the report's
certificateStatus: Pending for Approver, Approved by System, Order Accepted) maps to
pending, so the record is pending rather than issued without a body. An
unrecognized or non-pending state, and other download failures, keep the existing
result. Docs no longer claim the plugin never acts on certificateState.
… certificate and a pending state

Opt-in with CERTINEXT_V2_FULFILLED_PENDING_SYNC=1, read-only, DCV off; orders from
CERTINEXT_V2_SINGLE_RECORD_ORDERS. Also relaxes nothing in the sync test, which now
expects pending without a body. Live 2026-11-16: 1125823297 (Pending for Approver)
and 6292373831 (Approved by System) both returned pending (90); the one-order sync
emitted 1125823297 pending.
…sign synced certificates a template

The gateway gives a synced record a certificate profile only when its ProductID
equals a configured template's ProductID (a GetProductIds() name) exactly
(Gateway-AnyCA-REST CertificateService.CreateOrUpdateDBCertificate, called only from
CASyncJob). Both syncs sent CERTInext product codes, which never matched: all 927
sync-created lab rows had no profile, and those certificates reached Command with no
template.

Each V1/V2 sync pass now reads the account catalog once (on first use) and names a
code by productTypeID via the inverse of ProductTypeIdsV2. No fixed code table: the
V1-era DefaultProductCodes would label the sandbox's DV 842 'OV SSL'. Unknown codes,
types with no plugin product, and an unreadable catalog (one warning) keep the code.
The sync summaries gain ProductNames Resolved/Unresolved. GetSingleRecord is
unchanged: the gateway doesn't use its ProductID for the mapping.

Includes a read-only catalog probe (V1 and V2 catalogs are identical on the sandbox).
spbsoluble and others added 3 commits November 16, 2026 14:15
…ad-only)

Explains why a gateway row isn't re-saved by the sync. Opt-in with
CERTINEXT_SYNC_PRODUCTID_PROBE=1 and CERTINEXT_PROBE_ORDERS. Live 2026-11-16: the 8
gateway rows still pending without a profile are all 'Order Cancelled | Rejected due
to Order Cancellation' (Track: cancelled), which the sync skips.
… still holds it as pending

Both syncs skip orders cancelled or rejected at CERTInext, and the gateway changes a
row only when the sync emits a record for it, so an order it held as pending stayed
pending indefinitely (8 kfclab rows, all 'Order Cancelled | Rejected due to Order
Cancellation', Track: cancelled). Before skipping, the sync now asks the gateway
(ICertificateDataReader.GetStatusByRequestID): held as pending -> emit failed with no
certificate, once. No row (ArgumentException), already terminal, issued/revoked
(never downgraded), no reader, or a lookup error keep the skip. Summaries gain
FailedPropagated. Issue 0098.
@spbsoluble
spbsoluble added this pull request to stack #45 November 17, 2026 03:19
spbsoluble and others added 2 commits November 16, 2026 20:02
…ildcard CN

A DV/OV request with CN = apex and SAN = *.apex failed with EMS-1173: the
wrapper keys "wildcard" on certificate.domain alone and resolved a plain
UCC product. Sending the wildcard as the domain is rejected too (EMS-1056,
the domain must match the CSR CN). Both confirmed live.

With no template ProductCode, the plugin now reads the catalog and sends
the account's single active Wildcard UCC product (typeID 21 DV / 22 OV) as
X-Product-Code. No match, several matches, a catalog failure, or EV fails
before any order is placed, asking for ProductCode.

Adds unit coverage and an opt-in live probe (CERTINEXT_V2_WILDCARD_SAN_PROBE).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant